import httb from './HTTPS';
export function createAction(method,api,mtype){
  return async function ({commit,state},params={}) {
    const res=await httb[method](api,params);
    mtype&&res&&res.ok&&res.data&&commit(mtype,res.data);
    return res.data
  }
}
export function createPutAction(method, api, mtype) {
  return async function({ dispatch, commit }, { body = {}, params = {} }) {
      const res = await httb[method](api, body, params)
      mtype && res.data && commit(mtype, res.data)
      return res
  }
}
